package com.lingnan.club.mapper;

import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lingnan.club.pojo.Sign;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * @author 邓仁鸿鸿
 * @since 2022-04-05
 */
public interface SignMapper extends BaseMapper<Sign> {



    /*增加活动*/
    @Insert ("insert into club_sign(s_id,name,begin_time,end_time,sign_time,late_time,is_deleted) values(#{id},#{name},now(),now() + INTERVAL + #{endTime} minute,#{signTime},#{lateTime},#{isDeleted})")
    boolean publishSignActive(Sign sign);

    /*删除活动*/
    @Delete ("delete from club_sign where s_id=#{id}")
    Integer deleteSignById(Integer id);

    /*修改活动*/
    @Update("update club_sign set name=#{name} where s_id=#{id}")
     int updateSignActive(Sign sign);

    /*通过名字查询活动*/
    Map<String,Object> selectMapById(@Param("id") Integer id);

    //查询全部
    @Select("select * from club_sign")
    List<Sign> findAll();

}
